package com.example.common.model;


import com.example.common.model.bean.JVideo;
import com.example.common.model.net.RetrofitModel;
import com.example.common.model.bean.JavaCourse;
import com.example.commonlib.base.model.SuperModel;
import com.example.commonlib.net.SchedulersTransformer;
import com.example.commonlib.net.ServiceResponse;


public class JavaCourseModel extends SuperModel {


    public static JavaCourseModel getInstance() {
        return getInstance(JavaCourseModel.class);
    }


    public void getTextJavaCourseList(int page, ServiceResponse<JavaCourse[]> subscriber) {
        RetrofitModel.getServiceAPI().getTextJavaCourseList(page)
                .compose(new SchedulersTransformer<JavaCourse[]>())
                .subscribe(subscriber);
    }

    public void getJavaCourseFromDir(int unit, int page, ServiceResponse<JavaCourse[]> response) {
        RetrofitModel.getServiceAPI().getJavaCourseFromDir(unit, page)
                .compose(new SchedulersTransformer<JavaCourse[]>())
                .subscribe(response);
    }

    public void getVideoList(int page, ServiceResponse<JVideo[]> response){
        RetrofitModel.getServiceAPI().getVideoList(page)
                .compose(new SchedulersTransformer<JVideo[]>())
                .subscribe(response);
    }

}
